﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CategoryAdd.aspx.cs" Inherits="Com.CMS263.Web.manage.ManagerCategory.CategoryAdd" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title></title>
     <script type="text/javascript" language="javascript" src="../../js/jquery-1.4.2.min.js"></script>

    <link href="../style/main.css" rel="stylesheet" type="text/css" />
    <link href="../common/validator.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript" language="javascript" src="../../js/ui.core.js"></script>

    <link href="../themes/base/ui.all.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript" language="javascript" src="../../js/ui.datepicker.js"></script>
    <script  language="javascript" type="text/javascript">
        function Saves() {
            var flag = false;
            if ($("#CatDesc").val().length < 1) {
                $("#CatDescSpan").html("<span class=\"Tootip\">请输入描述！</span>");
            } else {
                $("#CatDescSpan").html("");
            }
            if ($("#CatName").val().length < 1) {
                $("#CatNameSpan").html("<span class=\"Tootip\">请输入类别名称！</span>");
            }
            else {
                $("#CatNameSpan").html("");
            }
            if ($("#MeasureUnit").val().length < 1) {
                $("#MeasureUnitSpan").html("<span class=\"Tootip\">请输入数量单位！</span>");
            }
            else {
                $("#MeasureUnitSpan").html("");
            }
            if ($("#KeyWord").val().length < 1) {
                $("#KeyWordSpan").html("<span class=\"Tootip\">请输入关键字！</span>");
            }
            else {
                $("#KeyWordSpan").html("");
            }
            if ($("#GoodsType").val() < 1) {
                $("#GoodsTypeSpan").html("<span class=\"Tootip\">请选择商品类型！</span>");
            }
            else {
                $("#GoodsTypeSpan").html("");
            }
            if ($("#CatName").val().length > 0 && $("#MeasureUnit").val().length > 0 && $("#KeyWord").val().length > 0 && $("#CatDesc").val().length > 0) {

                flag = true;
            }
            if (flag) {
                return flag;
            } else {
                alert("请填写完整！");
            }
        }
        function checkNum(obj) {
            var tempstr;
            //先把非数字的都替换掉，除了数字和.   
            tempstr = obj.value.replace(/[^\d]/g, "");
            obj.value = tempstr;
        }
    </script>
</head>
<body>
     <form id="form1" runat="server">
    <div>
        <table width="96%" border="0" align="center" cellpadding="0" cellspacing="0" class="table_1">
            <tr>
                <td height="23" colspan="2" class="table_2">
                    添加产品类别
                </td>
            </tr>
            <tr>
                <td class="tdleft">
                    类别：
                </td>
                <td class="tdside">
                 <select id="ParentId" name="ParentId">
                        <option value="0">父节点</option>
                        <%int j = 3;
                          foreach (Com.CMS263.PO.Category caP in catePrList)
                          {
                              if (caP.ParentId == 0)
                              {
                        %>
                        <option value="<%=caP.Id %>">
                            <%=caP.CatName%></option>
                       <%-- <%
                                
                            Com.CMS263.BLL.CategoryBLL cateBll = new Com.CMS263.BLL.CategoryBLL();
                            System.Collections.Generic.IList<Com.CMS263.PO.Category> cateList = new System.Collections.Generic.List<Com.CMS263.PO.Category>();
                            cateList = cateBll.FindByParentId(caP.Id);
                            if (cateList.Count > 0)
                            {
                                foreach (Com.CMS263.PO.Category item in cateList)
                                {
                                                                            
                        %>
                        <option value="<%=item.Id %>">
                            <%for (int i = 0; i < j; i++)
                              {
                                  Response.Write("&nbsp;");
                              }     %><%=item.CatName%></option>
                        <%
                            }
                                   
                                }
                       
                        %>--%>
                        <%}
                          }%>
                    </select> 
                </td>
            </tr>
            <tr>
                <td class="tdleft">
                    类别名称:
                </td>
                <td class="tdside">
                    <asp:TextBox ID="CatName" runat="server" ></asp:TextBox><span id="CatNameSpan"></span>
                </td>
            </tr>          
            <tr>
                <td class="tdleft">
                    排序:
                </td>
                <td class="tdside">                 
                   <input id="SortOrder" type="text" name="SortOrder" onkeyup="checkNum(this);" onblur="checkNum(this);"/>

                </td>
            </tr>
            <tr>
                <td class="tdleft">
                    数量单位:
                </td>
                <td class="tdside">
                    <asp:TextBox ID="MeasureUnit" runat="server" Width="264px" ></asp:TextBox><span id="MeasureUnitSpan"></span>
                </td>
            </tr>
            <tr>
                <td class="tdleft">
                    是否显示:
                </td>
                <td class="tdside">                    
                    <input id="IsShow" name="IsShow" type="checkbox"  style=" width:20px" value="true"/>是
                </td>
            </tr>
            <tr>
                <td class="tdleft">
                     搜索关键字::
                </td>
                <td class="tdside">
                    <asp:TextBox ID="KeyWord" runat="server" Width="264px" ></asp:TextBox><span id="KeyWordSpan"></span>
                </td>
            </tr>
            <tr>
                <td class="tdleft">
                    商品类型:
                </td>
                <td class="tdside">
                     <select id="GoodsType" name="GoodsType"> 
                      <option value="0">请选择....</option>
                <%
                    foreach (Com.CMS263.PO.ProdType pa in typeList)
         {%>
                    <option value="<%=pa.Id%>"><%=pa.TypeName%></option>
                    <%} %>
                    </select>  
                    <span id="GoodsTypeSpan"></span>
                </td>
            </tr>         
            <tr>
                <td class="tdleft">
                    类别描述:
                </td>
                <td class="tdside">                   
                  <TEXTAREA NAME="CatDesc" id="CatDesc" ROWS="5" COLS="50"></TEXTAREA>

                    <span id="CatDescSpan"></span>
                </td>
            </tr>            
            <tr>
                <td class="tdleft">
                </td>
                <td class="tdside">
                    <asp:Button ID="btnSave" runat="server" Text="保 存" 
                        OnClientClick="if(!Saves()){return false;}" Width="70px" 
                        onclick="btnSave_Click" />
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
